﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

using Global.Class.Library;

namespace DataAccessLayer
{
    public static class GlobalDataObjectAction
    {
        /// <summary>
        /// Get Save Conflict of a Data Entry (Data Transaction Object)
        /// </summary>
        /// <param name="storedProcedureName"></param>
        /// <param name="findIdentityID"></param>
        /// <returns></returns>
        public static bool SaveConflict(string storedProcedureName, int findIdentityID)
        {
            SqlParameter[] sqlParameter = new SqlParameter[1];
            sqlParameter[0] = new SqlParameter("FindIdentityID", findIdentityID); sqlParameter[0].SqlDbType = SqlDbType.Int; sqlParameter[0].Direction = ParameterDirection.Input;

            int existIdentityID = SQLDatabase.GetReturnValue(storedProcedureName, CommandType.StoredProcedure, sqlParameter);
            return existIdentityID != -1;
        }

    }
}
